<template>
    <el-breadcrumb separator=">">
        <el-breadcrumb-item v-for="item in breadArr" :to="{ path: item.path }">{{ item.meta.title }}</el-breadcrumb-item>
        <!-- <el-breadcrumb-item>promotion detail</el-breadcrumb-item> -->
    </el-breadcrumb>
</template>

<script setup lang='ts'>
import { useRoute } from 'vue-router';
// 获取当前的路由对象
const route = useRoute();
// console.log('route', route);

// 引入监听器函数
import { watch, ref } from 'vue';
const breadArr = ref<any>([]);
watch(route, (newvalue) => {
    // console.log('newvalue', newvalue);
    breadArr.value = newvalue.matched.filter(item => item.meta.title)
}, {
    immediate: true
})



</script>
<style scoped>
.el-breadcrumb {
    margin-left: 10px;
}
</style>